package com.twm.aop;


import com.twm.exception.AbnormalPositioning;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
/**
 * 根据前置通知去动态切换数据源
 * @ClassName UpdataDataSouceMethodBeforeAdvice
 * @Description TODO
 * @Author twm17
 * @Date 2020/10/27 10:13
 * @Version 1.0
 */
@Slf4j
//@Component
@Aspect
public class UpdataDataSouceMethodBeforeAdvice {
//    @Pointcut("execution(public * com.teenet.e800.*.impl.*Impl.*(..))")
//    @Pointcut("execution(com.teenet.e800.common.ServerResponse.*(..)")
    @Pointcut
    public void pointCut() { }

    @Before("pointCut()")
    public void before(){
         log.info("开启前置通知--------------");
    }

    @AfterThrowing(value = "pointCut()",throwing = "e")
    public void err(Exception e) {
        String errName = AbnormalPositioning.getExceptionLineNumberAndMethodName(e);
        log.info(errName);
    }

    @After("pointCut()")
    public Object after(JoinPoint joinPoint) {
        log.info("");
        Object arg = joinPoint.getArgs()[0];
        return null;
    }

}
